#ifndef QQ_SETS
#define QQ_SETS

/*define config*/

#include <qapplication.h>
#include <qdir.h>
#include <qnetworkproxy.h>
#include <qsettings.h>
#include <qsharedmemory.h>
#include <qstandardpaths.h>

#include "core/QQConfig.h"

#define qq_settings QQSettings::getInstance()

#define LOG_FILE_MAX_SIZE 1048576*10
#define LOG_FILE_MAX_FILES 10
#define LOG_FILES_MAX_SIZE 1048576*100
#define LOG_FILE_CACHE_SIZE 1048576
#define ZIP_FILE_CACHE_SIZE 4096
#define OPENSSL_KEY "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"

#define IP "localhost"
#define PORT 8888
#define PACKAGE_SIZE_INFO 4
#define MODEL_INVOKE_NAME "invoke"

class QQSettings :public QObject
{
	Q_OBJECT

private:
	QQSettings(QObject* parent = nullptr);
	~QQSettings();
public:
	static QQSettings* getInstance();
	void init();
	void destroy();

	//user directories
	static QString userDataDirectory();
	static QString userDownloadDirectory();
	static QString userImageDirectory();
	static QString userVideoDirectory();
	static QString userAudioDirectory();
	static QString userAnimationDirectory();
	static QString userLogDirectory();
	static QString userLogZipDirectory();

	//application directory
	QString applicationResourcesDirectory();
	QString applicationDhapeLibraryDirectory();
	QString applicationImageLibraryDirectory();
	QString applicationImageLibraryDirectory(const QString& type);
	QString applicationApplicationsLibraryDirectory();
	QString applicationCustomizationDirectory();
	QString applicationCustomFontDirectory();
	QString applicationAudiosLibraryDirectory();
	QString applicationVideosLibraryDirectory();
	QString applicationAnimationsLibraryDirectory();
	QString applicationStartupHintsDirectory();

	QString getQRCodeEntryBaseUrl() const;
	void setCurrentAccountEntryState(bool state);
	bool checkCurrentAccountEntryState(const QString& account);

	void setUserInfo(QQUser* user);
	QQUser* getUserInfo()const;

	qint64 getPictureMaxSize()const;
	qint64 getPictureMaxCount()const;
	QSize getPictureScreenMaxSize()const;
	qint64 getFileMaxSize()const;
	qint64 getFileMaxCount()const;
	qint64 getFilePieceSize()const;
private:
	QQUser* mUserInfo;
	qint64 mPictureMaxSize = 10;
	qint64 mPictureMaxCount = 10;
	QSize mPictureScreenMaxSize;
	qint64 mFileMaxSize = 10 * 1024 * 1024;
	qint64 mFileMaxCount = 10;
	qint64 mFilePieceSize = 1024 * 1024;
};

#endif // !QQ_SETS


